﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ComputeLib
{
    class Global
    {
        public static Dictionary<String, Object> constVars = new Dictionary<string, object>();
        
        public static List<ICalculation> calculations = new List<ICalculation>();

        public static List<String> inputVars = new List<String>();

        public static void check()
        {

        }

        public static void initInputVars(String inputVars)
        {

        }

        public  static void initCaculations()
        {
        

            List<ICalculation> list = new List<ICalculation>();
            list.Add(new Calculation(
                 /*计算变量名*/      "AInlet",
                 /*计算变量描述*/    "进口面积",  
                 /*计算公式*/        "(pi/4)* Math.Pow((DInlet/1000),2)", 
                 /*依赖的输入变量*/  "DInlet"));


            list.Add(new Calculation(
                /*计算变量名*/      "AOutlet",
                /*计算变量描述*/    "进口面积",
                /*计算公式*/        "(pi/ 4) * Math.Pow((DOutlet), 2)",
                /*依赖的输入变量*/  "DOutlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "EInlet",
                /*计算变量描述*/    "进口相对粗糙度",
                /*计算公式*/        "KInlet / DInlet",
                /*依赖的输入变量*/  "KInlet,DOutlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "VInlet",
                /*计算变量描述*/    "进口流速",
                /*计算公式*/        "(WorkQ / 3600) / AInlet",
                /*依赖的输入变量*/  "WorkQ,AInlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "VOutlet",
                /*计算变量描述*/    "出口流速",
                /*计算公式*/        "(WorkQ / 3600) / AOutlet",
                /*依赖的输入变量*/  "WorkQ,AOutlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "ReyInlet",
                /*计算变量描述*/    "进口雷诺数",
                /*计算公式*/        "(DInlet * VInlet) / 0.000001",
                /*依赖的输入变量*/  "DInlet,VInlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "ReyOutlet",
                /*计算变量描述*/    "出口雷诺数",
                /*计算公式*/        "(DOutlet * VOutlet) / 0.000001",
                /*依赖的输入变量*/  "DOutlet,VOutlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "FInlet",
                /*计算变量描述*/    "进口摩擦系数",
                /*计算公式*/        "1.0 / Math.Pow(1.8 * Math.Log10(6.9 / ReyInlet + Math.Pow((EInlet / 3.7), 1.11)), 2)",
                /*依赖的输入变量*/  "ReyInlet,EInlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "FOutlet",
                /*计算变量描述*/    "出口摩擦系数",
                /*计算公式*/        "1.0 / Math.Pow(1.8 * Math.Log10(6.9 / ReyOutlet + Math.Pow((EOutlet / 3.7), 1.11)), 2)",
                /*依赖的输入变量*/  "ReyOutlet,EOutlet"));

            list.Add(new Calculation(
                /*计算变量名*/      "Teta",
                /*计算变量描述*/    "Teta",
                /*计算公式*/        "(TMedia + 273.15) / 647.14",
                /*依赖的输入变量*/  "TMedia"));

            list.Add(new Calculation(
                /*计算变量名*/      "Tau",
                /*计算变量描述*/    "Tau",
                /*计算公式*/        "1 - Teta",
                /*依赖的输入变量*/  "Teta"));

             list.Add(new Calculation(
                /*计算变量名*/      "Rho",
                /*计算变量描述*/    "Rho",
                /*计算公式*/        "322 * (1 + 1.99602 * Math.Pow(Tau, 1.0 / 3) + 1.10123 * Math.Pow(Tau, 2.0 / 3) + (-0.512506) * Math.Pow(Tau, 5.0 / 3) + (-1.75263) * Math.Pow(Tau, 16.0 / 3) + (-45.4485) * Math.Pow(Tau, 43.0 / 3) + (-675615) * Math.Pow(Tau, 110.0 / 3))",
                /*依赖的输入变量*/  "Tau"));

             list.Add(new Calculation(
                /*计算变量名*/      "StpQ",
                /*计算变量描述*/    "标况流量",
                /*计算公式*/        "(StpRotarySpeed / WorkRotarySpeed * 1.0) * WorkQ",
                /*依赖的输入变量*/  "StpRotarySpeed,WorkRotarySpeed,WorkQ"));





        }
    }
}
